package com.yj.change.data;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.AsyncTask;

import java.util.List;

public class Utils {

    @SuppressLint("StaticFieldLeak")
    public static void initAppList(final Context context, final AppCallBack callBack) {
        new AsyncTask<Void, Void, List<MyAppInfo>>() {
            @Override
            protected List<MyAppInfo> doInBackground(Void... voids) {
                return ApkTool.scanLocalInstallAppList(context.getPackageManager());
            }

            @Override
            protected void onPostExecute(List<MyAppInfo> infos) {
                super.onPostExecute(infos);
                callBack.onSuccess(infos);
            }
        }.execute();
    }

    public static interface AppCallBack {
        void onSuccess(List<MyAppInfo> infos);
    }


}
